from pyecharts import options as opts
from pyecharts.render import make_snapshot
from snapshot_phantomjs import snapshot

from pyecharts.charts import Funnel

from pyecharts.faker import Faker

data = [
    list(z) for z in zip(Faker.choose(), Faker.values())
]

def funnel_chart() -> Funnel:
    # ********* Begin *********#
    funnel = (
        Funnel()
        .add("商品",data)
        .set_global_opts(
        title_opts=opts.TitleOpts(title="Funnel-基本示例",subtitle="Funnel-副标题"))
    )
    # ********** End **********#
    return funnel

# make_snapshot(snapshot, funnel_chart().render("render2.html"), 'student_answer.png') # 输出图片
